#ifndef __UBT_CONFIG_H__
#define __UBT_CONFIG_H__

#include <ubt_mqtt/node.h> 
#include <string>

#define ROBOT_ALGORITHN_TYPE_AMR    "amr"
#define ROBOT_ALGORITHN_TYPE_USLAM  "uslam"
#define ROBOT_ALGORITHN_TYPE_QRCODE "qr_code"

#if __cplusplus == 201103L
namespace std
{
    template<typename T, typename... Ts>
    std::unique_ptr<T> make_unique(Ts&&... params)
    {
        return std::unique_ptr<T>(new T(std::forward<Ts>(params)...));
    }
}
#endif

namespace ubt {

static const std::string g_package_name = "ubt_mqtt";
static const std::string g_robot_name = "U1000";
static const std::string g_robot_sn   = "VAC002UBT00000082";
static const std::string g_robot_type = "amr";

struct location_pose_t
{
    float x;
    float y;
    float theta;
};

struct mqtt_paramer_t
{
    std::string name;
    std::string password;
    std::string address;
    short port;
};

struct map_origin_info_t
{
    std::string image;
    float resolution;
    location_pose_t origin;
    float negate;
    float occupied_thresh;
    float free_thresh;
    std::string id;
    std::string name;
    std::string code;
    std::string map_hash;
};

struct task_info_t
{
    std::string id;    // 任务id
    std::string name;  // 任务名称
    std::string code;  // 任务编码
};

struct robot_version_info_t
{
    std::string ros;        // ros版本
    std::string powerboard; // 电源板版本
    std::string motor;      // 电机版本
};

class ConfigDataInfo
{
public:
    static ConfigDataInfo& Instance();
    virtual ~ConfigDataInfo();

    bool Initialize();

    /**
     * @brief 获取服务器配置文件路径
     */
    std::string &getServerParamerFilePath() {return _server_paramer_path;}

    /**
     * @brief Get the Robot Serial Number
     */
    std::string &getRobotSerialNumber() {return _robot_sn;}

    /**
     * @brief Get the Robot navigation Algorithm Type
     */
    std::string &getRobotAlgorithmType() {return _robot_type;}

    /**
     * @brief Get the Robot Name
     */
    std::string &getRobotName() {return _robot_name;}

    /**
     * @brief 获取地图信息文件路径 
     */
    std::string &getMapYamlFilePath() { return _map_origin_path; }

    /**
     * @brief 获取地图文件路径
     */
    std::string &getMapImageFilePath() { return _map_image_path; }

    /**
     * @brief Get the Task File Path
     */
    std::string &getTaskFilePath() { return _task_file_path; }

    /**
     * @brief Get the Config File Path
     */
    std::string &getConfigFilePath() { return _config_file_path; }

    /**
     * @brief Get the Local Point File Path
     */
    std::string &getLocalPointFilePath() { return _localpoint_file_path; }

    /**
     * @brief Get the Fixed Path File Path
     */
    std::string &getFixedPathFilePath() { return _fixedpath_file_path; }

private:
    ConfigDataInfo();

    std::string _robot_name;
    std::string _robot_sn;
    std::string _robot_type;

    std::string _map_origin_path;
    std::string _map_image_path;

    std::string _task_file_path;        // 任务保存路径
    std::string _config_file_path;      // 配置文件保存路径
    std::string _localpoint_file_path;  // 本地站点信息保存路径

    std::string _fixedpath_file_path;   // 固定路径信息保存路径

    std::string _server_paramer_path; // mqtt server 信息文件路径
};

}

#endif // !__UBT_CONFIG_H__

